<!DOCTYPE>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>CartoCSS_Text</title>
    <style type="text/css">
        body {
            margin: 0;
            overflow: hidden;
            background: #fff;
        }

        #map {
            position: relative;
            height: 553px;
            border: 1px solid #3473b7;
        }
    </style>
    <link href='./css/bootstrap.min.css' rel='stylesheet' />
    <link href='./css/bootstrap-responsive.min.css' rel='stylesheet' />
    <script src='../libs/SuperMap.Include.js'></script>
    <script type="text" id="textData">
        #China___China{
        text-fill:#ff0000;
        text-face-name:"Serif";
        text-size:26;
        text-align:"center";
        text-vertical-alignment:"middle";
        }
        #World_Continent_txt___China{
        text-fill:#996699;
        text-face-name:"Sans-serif";
        text-size:25;
        text-align:"center";
        text-vertical-alignment:"middle";
        }
        #World_Ocean_txt___China{
        text-fill:#456789;
        text-face-name:"Monospace ";
        text-size:26;
        text-align:"center";
        text-vertical-alignment:"middle";
        }
    </script>
    <script type="text/javascript">
        var map, layer, lat, lon, geolocate, infowin,lonLat,geometryInfo,cartoCss, host = document.location.toString().match(/file:\/\//) ? "http://localhost:8090" : 'http://' + document.location.host;
        url = host + "/iserver/services/map-china400/rest/maps/China";

        function init() {
            if(!document.createElement('canvas').getContext) {
                alert('您的浏览器不支持 canvas，请升级');
                return;
            }

            map = new SuperMap.Map("map", {controls: [
                new SuperMap.Control.ScaleLine(),
                new SuperMap.Control.Zoom(),
                new SuperMap.Control.MousePosition(),
                new SuperMap.Control.Navigation({
                    dragPanOptions: {
                        enableKinetic: true
                    }
                })]
            });
            cartoCss=document.getElementById("textData").text;
            layer = new SuperMap.Layer.TiledVectorLayer("China", url,{cacheEnabled:true,returnAttributes:true},{useLocalStorage:true,cartoCss:cartoCss});
            layer.events.on({"layerInitialized": addLayer});
        }


        function addLayer() {
            map.addLayers([layer]);
            var center = new SuperMap.LonLat(0,3000000);
            map.setCenter(center, 2);
        }
    </script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>
